--
-- Author: shunguo.chen
-- Date: 2019-05-20 14:19:21
--
-- LegendStarPropRender 传奇星图属性
--

local ClassRef = app.mvc.createListViewCell(...)

--data =
function ClassRef.createWithData(data, node)
    local sprite = ClassRef.extend(node or cc.CSLoader:createNode(Res.LegendStarPropNode))
    if node == nil then
        ccui.Helper:doLayout(sprite)
    end
    sprite:init(data)
    return sprite
end
function ClassRef.create(node)
    return ClassRef.createWithData(nil, node)
end

-- data = {propId, propName, value, format}
function ClassRef:init(data)
    self.super.init(self, data)

    self:setContentSize(self._ui.Panel:getContentSize())

    self:refresh()
end

function ClassRef:refresh()
    if self._data then
        local data = self._data
        self._ui.tlt:setString(L(data[2]) .. ":")
        if data[3] > 0 then
            self._ui.num:setString("+" .. GD:getPropValueShow(data[3], data[4]))
        else
            self._ui.num:setString("-")
        end
    end
end

return ClassRef
